$(document).ready(function(){
    $("#fancybox_youtube").click(function() {
        $.fancybox({
            'padding'           : 0,
            'autoScale'         : false,
            'transitionIn'      : 'none',
            'transitionOut'     : 'none',
            'title'             : this.title,
            'width'             : 680,
            'height'            : 495,
            'href'              : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
            'type'              : 'swf',
            'swf'               : {
                'wmode'		: 'transparent',
                'allowfullscreen'	: 'true'
            }
        });
        return false;
    });
    $("#youtube_img").attr("src", getScreen('http://www.youtube.com/watch?v=4n8g46z3FME','small'));
});
/* este metodo es para la imagen thumbnail de youtube */
function getScreen(url,size){/* size: small/big */
    if(url === null){ return ""; }

    size = (size === null) ? "big" : size;
    var vid;
    var results;

    results = url.match("[\\?&]v=([^&#]*)");

    vid = ( results === null ) ? url : results[1];

    if(size == "small"){
        return "http://img.youtube.com/vi/"+vid+"/2.jpg";
    }else {
        return "http://img.youtube.com/vi/"+vid+"/0.jpg";
    }
}